/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.4.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     twoPhaseEulerFoam;

startFrom       latestTime;

startTime       0;

stopAt          endTime;

endTime         100;

deltaT          1e-5;

writeControl    adjustableRunTime; //  runTime

writeInterval   0.01;

//writeControl    timeStep;

//writeInterval   10;


purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression uncompressed;

timeFormat      general;

timePrecision   6;

runTimeModifiable on;

adjustTimeStep  yes;

maxCo           0.1;

maxDeltaT       1e-04;
//libs ("libparticleSlip.so");
functions
{

 probes
    {
        type            probes;
        functionObjectLibs ("libsampling.so");
        outputControl   timeStep;
        probeLocations
        (
            ( 0.1 0.0635 0 )
            ( 0.1 0.127 0 )
	    ( 0.1 0.1905 0 )

            ( 0.3 0.0635 0 )
            ( 0.3 0.127 0 )
	    ( 0.3 0.1905 0 )

            ( 0.5 0.0635 0 )
            ( 0.5 0.127 0 )
	    ( 0.5 0.1905 0 )

            ( 0.2 0.127 0 )
            ( 0.4 0.127 0 )
      
        );
        fixedLocations  true;
        fields
        (   
	    alpha.particles
            U.air
	    U.particles
            T.particles
            T.air
	    Theta.particles
        );
    }


      fieldAverage1
    {
         /*type            fieldAverage;
         functionObjectLibs ( "libfieldFunctionObjects.so" );
	 enabled         true;
         outputControl   outputTime;
	 after 0.01;
       fields*/

        // Type of functionObject
        type            fieldAverage;

        // Where to load it from (if not already in solver)
        functionObjectLibs ("libfieldFunctionObjectsCustom.so");

        // Function object enabled flag
        enabled         true;

        // When to output the average fields
        outputControl   outputTime;

	// Time at which averaging should start
	//after 5.55;

        // Fields to be averaged - runTime modifiable
        fields
        (
           /* U.particles
            {
                 mean        on;
                 prime2Mean  off;
                 base        time;
            }

            U.air
            {
                 mean        on;
                 prime2Mean  off;
                 base        time;
            }*/

            alpha.particles
            {
                 mean        on;
                 prime2Mean  on;
                 base        time;
            }
	   /* Theta.particles
            {
                 mean        on;
                 prime2Mean  off;
                 base        time;
            }
            p
            {
                 mean        on;
                 prime2Mean  off;
                 base        time;
            }*/
        );
    }




doInit {
	 type initSwakFunctionObject;
       }

aparticlesRMS_VFLUID
{
    type		swakExpression;
    valueType		cellSet;
    setName		VFLUID;
     aliases {
            aparticlesMean alpha.particlesMean;
            aparticles alpha.particles;
        }
    verbose		true;
    expression		"pow(pow((aparticlesMean-aparticles),2.0),0.5)/0.3";
   // variables		"aparticlesRMS=pow(pow((aparticlesMean-aparticles),2.0),0.5);";
   accumulations	(
        			average
    			);
    autoInterpolate	true;
    warnAutoInterpolate false;
    outputControl       timeStep;
    outputInterval  	1;
}


aparticlesAvg_VFLUID
{
    type		swakExpression;
    valueType		cellSet;
    setName		VFLUID;
     aliases {
            aparticles alpha.particles;
        }
    verbose		true;
    expression		"aparticles";
   accumulations	(
        			average
    			);
    autoInterpolate	true;
    warnAutoInterpolate false;
    outputControl       timeStep;
    outputInterval  	1;
}

thetaParticlesAvg_VFLUID
{
    type		swakExpression;
    valueType		cellSet;
    setName		VFLUID;
     aliases {
            thetaParticles Theta.particles;
        }
    verbose		true;
    expression		"thetaParticles";
   accumulations	(
        			average
    			);
    autoInterpolate	true;
    warnAutoInterpolate false;
    outputControl       timeStep;
    outputInterval  	1;
}

Cov_aparticles_VFLUID
{
    type		swakExpression;
    valueType		cellSet;
    setName		VFLUID;
     aliases {
            aparticles alpha.particles;
        }
    verbose		true;    
    expression		"pow(((aparticles-aparticlesAvg)*(aparticles-aparticlesAvg)),0.5)/aparticlesAvg";
    variables		"aparticlesAvg=(sum(aparticles*vol()))/sum(vol());";
    accumulations	(
        			average
    			);
    autoInterpolate	true;
    warnAutoInterpolate false;
    outputControl       timeStep;
    outputInterval  	1;
}


Cov_thetaParticles_VFLUID
{
    type		swakExpression;
    valueType		cellSet;
    setName		VFLUID;
     aliases {
            thetaParticles Theta.particles;
        }
    verbose		true;    
    expression		"pow(((thetaParticles-thetaParticlesAvg)*(thetaParticles-thetaParticlesAvg)),0.5)/thetaParticlesAvg";
    variables		"thetaParticlesAvg=(sum(thetaParticles*vol()))/sum(vol());";
    accumulations	(
        			average
    			);
    autoInterpolate	true;
    warnAutoInterpolate false;
    outputControl       timeStep;
    outputInterval  	1;
}


Cov_p_VFLUID
{
    type		swakExpression;
    valueType		cellSet;
    setName		VFLUID;
     
    verbose		true;    
    expression		"pow(((p-pAvg)*(p-pAvg)),0.5)/pAvg";
    variables		"pAvg=(sum(p*vol()))/sum(vol());";
    accumulations	(
        			average
    			);
    autoInterpolate	true;
    warnAutoInterpolate false;
    outputControl       timeStep;
    outputInterval  	1;
}

}

	libs
	(
		"libOpenFOAM.so"
		"libsimpleFunctionObjects.so"
		"libsimpleSwakFunctionObjects.so"
		"libswakFunctionObjects.so"
		"libswakTopoSources.so"
		"libgroovyBC.so"
	);


// ************************************************************************* //
